﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TradeForm
{
    public partial class FrmModifyPwd : Form
    {
        public FrmModifyPwd()
        {
            InitializeComponent();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.txtNewPwd1.Text != this.txtNewPwd2.Text)
            {
                this.lblMsg.Text = "两个新密码不一致。";
                return;
            }
            if (!Utility.PwdIsCorrect(Utility.UserID, this.txtOldPwd.Text))
            {
                this.lblMsg.Text = "原密码不对。";
                return;
            }
            if (Utility.ModifyPwd(Utility.UserID, this.txtOldPwd.Text, this.txtNewPwd1.Text))
            {
                this.lblMsg.Text = "修改成功。";
                return;
            }
        }

        private void FrmModifyPwd_Load(object sender, EventArgs e)
        {
            this.lblMsg.Text = string.Empty;
        }

        private void txt_Enter(object sender, EventArgs e)
        {
            this.lblMsg.Text = string.Empty;
        }

        private void btnQuit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
